// $Id:$
(function ($) {
Drupal.behaviors.qtip = {
  attach: function(context) {
    if( typeof Drupal.settings.block_refresh == 'undefined' ) { return; }
		$.each(Drupal.settings.block_refresh.settings, function(element, settings) {
      //Get argument from referring page and append to end of load request
      args = '';
      $.each(Drupal.settings.block_refresh.args, function(index, arg) {
        args += '/'+arg;
      });
      query = Drupal.settings.block_refresh.query;
     	if (settings['auto']) {
				setInterval(function() {
					$('#' + element + ' .content').load(Drupal.settings.basePath + Drupal.settings.pathPrefix +  'block_refresh/' + settings['block']['block'] + '/' + settings['block']['delta'] + args + query);
				}, settings['timer'] * 1000); // We need to multiply by 1000 because the admin enters a number in seconds,  but the setInterval() function expects milliseconds
			}
			if (settings['manual']) {
				refresh_link = '<div class="block-refresh-button">' + Drupal.t('Refresh') + '</div>';
				// We'll attach the refresh link to the header if it exists...
				if ($('#' + element + ' h2').length) {
					// note: for some reason I couldn't get $(this) to work, I don't know why
					$('#' + element + ' h2').before(refresh_link);
				}
				// ...otherwise we will attach it to the content
				else {
					$('#' + element + ' .content').before(refresh_link);
				}
			}
			
			$('.block-refresh-button').click(function() {
				$(this).addClass('block-refresh-button-throbbing');
				$('#' + element + ' .content').load(Drupal.settings.basePath + Drupal.settings.pathPrefix + 'block_refresh/' + settings['block']['block'] + '/' + settings['block']['delta'] + args + query, '', function() {
					$('.block-refresh-button').removeClass('block-refresh-button-throbbing');
				});
			});
		});
  }
};
})(jQuery);
;
(function($) {
  Drupal.behaviors.chosen = {
    attach: function(context) {
      var minWidth = Drupal.settings.chosen.minimum_width;
      //define options
      var options = {};
      options.search_contains = Drupal.settings.chosen.search_contains;
      options.placeholder_text_multiple = Drupal.settings.chosen.placeholder_text_multiple;
      options.placeholder_text_single = Drupal.settings.chosen.placeholder_text_single;
      options.no_results_text = Drupal.settings.chosen.no_results_text;

      $(Drupal.settings.chosen.selector, context)
        .not('#field-ui-field-overview-form select, #field-ui-display-overview-form select') //disable chosen on field ui
        .each(function() {
        if ($(this).find('option').size() >= Drupal.settings.chosen.minimum) {
          $(this).css({
            width : ($(this).width() < minWidth) ? minWidth : $(this).width()
          }).chosen(options);
        }
      });
       
      //enable Chosen for widgets  
      $('.chosen-widget', context).each(function() {
        $(this).css({
          width : ($(this).width() < minWidth) ? minWidth : $(this).width()
        }).chosen(options);
      });
    }
  }
})(jQuery);
;
(function($){Drupal.behaviors.isn3_google_track={attach:function(context,settings){var ANALYTICS_CATEGORIES_REGEXP=/google-track-(navigation)|(download)|(outbound)|(pagetab)/g;if(typeof _gaq=="undefined")return;function normalizeCategory(category){category=category.replace("google-track-","");category=category.charAt(0).toUpperCase()+category.slice(1);switch(category){case"Outbound":category+=" links";break;case"Download":category+="s";break;case"Pagetab":category="Page Tab";break}return category}$('a[class*="google-track-"], li[class*="google-track-"]').click(function(event){var $this=$(this),classes=$this.attr("class").toLowerCase().split(" "),category=null;if(classes.length){for(var n in classes){if(classes[n].match(ANALYTICS_CATEGORIES_REGEXP)){if($this.is("li")){$this=$(this).find("a")}_gaq.push(["_trackEvent",normalizeCategory(classes[n]),$this.text(),$this.attr("href")]);break}}}});$("#main-content div.js-anchor-dropdown select").change(function(event){var $this=$(this).find(":selected");if($this.val()=="")return;var classes=$this.attr("class").toLowerCase().split(" ");if(classes.length){for(var n in classes){if(classes[n].match(ANALYTICS_CATEGORIES_REGEXP)){_gaq.push(["_trackEvent",normalizeCategory(classes[n]),$this.text(),$this.val()]);break}}}});$("#edit-actions #edit-submit").click(function(event){var $this=$(this),nodetype=$this.data("nodetype"),textParam=null,extraParam=null;if(!nodetype)return;textParam=nodetype;extraParam="new-"+nodetype.replace("_","-");if(!!$this.data("iscomment")==true){textParam+="_comment";extraParam+="-comment"}_gaq.push(["_trackEvent","community",textParam,extraParam])})}}})(jQuery);

;
(function($){Drupal.behaviors.isn3_jcarousel_fix={attach:function(context,settings){$(window).load(function(){if($(".jcarousel-processed").length>0){setTimeout(function(){$(".jcarousel").jcarousel()},3e3)}});$(".kash-tab-nav ul li a").click(function(){if($(".ui-tabs-panel .jcarousel").length>0){setTimeout(function(){$(".ui-tabs-panel .jcarousel").jcarousel()},100)}})}}})(jQuery);

;
(function($){Drupal.behaviors.isn3_filefield_plupload={attach:function(context,settings){var el=$(".filefield-source-plupload",context);el.siblings().hide().end().parent().siblings().hide();if($("#page.forum").length>0){el.find(".description").show()}}}})(jQuery);

;
